#include "work_thread.h"

WorkThread::WorkThread(const char *name, WorkThread::Delegate* delegate) 
: BASECLASS(name) {
  delegate_ = delegate;
}

void WorkThread::Init() {
  if (delegate_) {
    delegate_->OnInit(this);
  }
}

void WorkThread::CleanUp() {
  if (delegate_) {
    delegate_->OnCleanup(this);
  }
}

void WorkThread::PostTask(const tracked_objects::Location& from_here,
                          const base::Closure& task) {
  DCHECK(IsRunning());
  message_loop()->PostTask(from_here, task);
}